def check(){
    def a = ""
    def b = null
    if (a?.trim()){  //  a为null或""  a?.trim()表达式为false
        println("not empty or null")
    }
    else {
        def c = a?.trim()
        println c
        println("a is empty or null")
    }    
}

println "1"+"2"

println '''123---LQ'''


def replace(){
    println "1,2,3".replace(",","/")

    println "1.2".replace(".", "/")
}


def trim(){
    println "  12 3 ".trim()
}


def contains(){
    println "1.1.1-20201102100215-alpha | war".contains("war")

}

def placeholder(){
    def x=1
    def y = 2
    println "${x}-${y}"

    // ====== 插值 , 只有 "" 可以, ''不行
    def a1 = "L"
    def a2 = "Q"
    println "${a1}${a2}"
    println '${a1}${a2}'
    println a1
}

def split(){
    def ss = "front_sdjc"
    println "${ss.split('_')[0]}"

    println "1.1.1-20201102100215-alpha | war".split("\\|")
    
    // 默认按空格
    println "1   2    3".split()

    println  "12,3".split(",")[0]
}


def 三元表达式(){
    ss = "成功1"
    println """${ss.contains('成功')? "<font>${ss}-成功</font>": "<font>${ss}-失败</font>"}"""
}

for (i in [1..4]){
    println i
}

def ss = "123"
def aa = "${ss}-123"
println aa